/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package megaboletosclient;

import clases.*;
import javax.swing.table.AbstractTableModel;

/**
 *
 * @author MARTIN
 */
public class TablaBoletosCliente extends AbstractTableModel{
	private static final long serialVersionUID = 1L;
	String[][] valore;
	private  String[] nombres = {"Evento","Fecha"};
	Boleto [] boleto;
	
	public TablaBoletosCliente(){
                try
			{

				valore = new String[1][2];
				
			}
		catch(ArrayIndexOutOfBoundsException e)
			{
				valore = new String[1][2];
			}
	}
	
	public TablaBoletosCliente(Boleto [] boleto){
		this.boleto=boleto;
		try
			{
				int filas = boleto.length;
				valore = new String[filas][2];
				int i =0;
				for(i=0; i<filas; i++)
					{
						valore[i][0]= ""+boleto[i].getClaveB();
						valore[i][1]= ""+boleto[i].getClaveE();
					}
			}
		catch(ArrayIndexOutOfBoundsException e)
			{
				valore = new String[1][2];
			}	
		
	}
		
	public Boleto[] getArray()
	{
		return boleto;
	}
	public int getRowCount() {
        return valore.length;
        }

        public int getColumnCount() {

            return valore[0].length;
        }

        public Object getValueAt(int rowIndex, int columnIndex) {
            return valore[rowIndex][columnIndex];
        }
        @Override
        public String getColumnName(int columnIndex){
            return nombres[columnIndex];

        }
}
